package com.example.active_record.meta;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
//自动填充类，实现MetaObjectHandler
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
    /**
     * 插入时填充逻辑
     * @param metaObject 元对象
     */

    @Override
    public void insertFill(MetaObject metaObject) {
        /*参数1：填充的字段名
        * 参数2：参数值
        * 参数3：元对象*/
        this.setFieldValByName("deleted",0,metaObject);
    }

    /**
     * 更新时填充逻辑
     * @param metaObject
     */
    @Override
    public void updateFill(MetaObject metaObject) {

    }
}
